Skip to content

docs: fix system prompt contradictions and suppress deepagents memory middleware - #721

Merged
avoidwork merged 5 commits into
mainfrom
docs/system-prompt-audit-fixes
Aug 9, 2026
Merged

docs: fix system prompt contradictions and suppress deepagents memory middleware#721
avoidwork merged 5 commits into
mainfrom
docs/system-prompt-audit-fixes

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

System prompt audit against deepagents source revealed contradictions and redundant sections. This PR resolves all findings.

Type of Change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes)
  • Performance improvement
  • CI / build / tooling

Testing

  • All 1085 tests pass (npm run test)
  • No new code paths introduced — prompt edits and one readFileSync load in deepAgents.js

Coverage

  • Line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with maintained line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Changes

prompts/SYSTEM_PROMPT.md

  1. Merged verbosity cap + Different Factor — philosophical observation is now conditional on context type (technical vs non-technical). No more conflicting signals.
  2. Removed hardcoded subagent tool lists — 10 agent type tool lists removed. Tool schemas are the source of truth; deepagents injects them dynamically at runtime.
  3. Dropped tool schema validation section — ~30 lines of infrastructure noise removed. The model does not need to understand how deepagents resolves and caches tool schemas.

src/agent/deepAgents.js

  1. Suppressed deepagents memory middleware — removed memory: [agentsPath] from createDeepAgent() and load AGENTS.md directly into the system prompt via readFileSync. This prevents MemoryMiddleware from wrapping memory content in deepagents hardcoded MEMORY_SYSTEM_PROMPT with conflicting guidelines.

Memory data (profile, clarifications, reflection, ephemeral) still flows through loadSystemPrompt()loadContext() → appended to the system prompt. Your MEMORY section now has sole authority over how memory is used.

… middleware

- Merge verbosity cap and Different Factor into single conditional rule
- Remove hardcoded subagent tool lists (drift-prone, schemas are source of truth)
- Drop tool schema validation section (infrastructure noise)
- Load AGENTS.md directly into system prompt instead of via memory: param
  to prevent deepagents MemoryMiddleware from injecting its own guidelines
@avoidwork
avoidwork force-pushed the docs/system-prompt-audit-fixes branch from 28a0ef0 to 67a1d26 Compare August 9, 2026 16:44
The manual string slicing in #relativePath() was mangling paths when
config.cwd was empty (defaulting to "" in config.yaml). This caused
deepAgents to receive invalid relative paths like 'home/...' instead of
'skills/...', leading to 'skill not found in registry' errors.

Replaced with path.relative() which correctly handles the conversion,
and added process.cwd() fallback when config.cwd is empty.
@avoidwork
avoidwork merged commit 4edbd5a into main Aug 9, 2026
2 checks passed
@avoidwork
avoidwork deleted the docs/system-prompt-audit-fixes branch August 9, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant